package net.netca.bmps.userservice.servicelayer;

import net.netca.bmps.userservice.service.SoPinService;
import net.netca.gdltax.bpms.webservice.CertServiceClient;
import net.netca.gdltax.bpms.webservice.CertServicePortType;
import net.netca.testwebservice.bo.XMLConfig;

public class SoPinServiceImpl implements SoPinService {

//	private static  String serviceurl = "http://192.168.0.147:8080/businessmanage/services/CertService";
	
	private static  String serviceurl = XMLConfig.getInstance().getUrl();
	
	private CertServicePortType stub=getStub();
	
	private CertServicePortType  getStub(){
		try {
			CertServiceClient client = new CertServiceClient(serviceurl);
			CertServicePortType service = client.getCertServiceHttpPort();
			//CertServiceLocator serverLocator=new CertServiceLocator();
			//serverLocator.setCertServiceHttpPortEndpointAddress(serviceurl);
			//CertServicePortType service=serverLocator.getCertServiceHttpPort();
			return service;

		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}	
	}
	
	public String GetSoPin(String sn) throws Exception{
		// TODO Auto-generated method stub
		return stub.getSoPin(sn);
	}

	public int SaveSoPin(String sn, String pwd) throws Exception{
		// TODO Auto-generated method stub
		return stub.saveSoPin(sn, pwd);
	}

}
